#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int n, res = 100010;
const int N = 100010;
const int M = 2 * N;
int e[M], ne[M], h[N], idx;
// 存储每个点是否已经被走过了
int flag[N];

// b链入a的节点
int add(int a, int b)
{
    ne[idx] = h[a];
    h[a] = idx;
    e[idx++] = b;
}

int dfs(int u)
{
    flag[u] = true;
    int sum = 1, ret = 0;
    for (int i = h[u]; ~i; i = ne[i])
    {
        int pos = e[i];
        if (!flag[pos])
        {
            // st[pos] = true;
            // 得到整棵树的节点数量
            int s = dfs(pos);
            // 找到所有子树节点的最大值
            ret = max(ret, s);
            sum += s;
        }
    }
    ret = max(ret, n - sum);
    // cout << ret << ":" << sum << endl;
    res = min(res, ret);
    return sum;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    memset(h, -1, sizeof(h));
    for (int i = 0; i < n - 1; ++i)
    {
        int a, b;
        cin >> a >> b;
        add(a, b), add(b, a);
    }
    dfs(n);
    cout << res << endl;
    return 0;
}
